home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / xpcom / nsITimelineService.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  13KB  |  359 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsITimelineService.idl
  3.  */
  4.  
  5. #ifndef __gen_nsITimelineService_h__
  6. #define __gen_nsITimelineService_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17. #ifdef MOZ_TIMELINE
  18.  
  19. /* starting interface:    nsITimelineService */
  20. #define NS_ITIMELINESERVICE_IID_STR "93276790-3daf-11d5-b67d-000064657374"
  21.  
  22. #define NS_ITIMELINESERVICE_IID \
  23.   {0x93276790, 0x3daf, 0x11d5, \
  24.     { 0xb6, 0x7d, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74 }}
  25.  
  26. /**
  27.  * nsITimelineService is used to constuct a timeline of program
  28.  * execution.  The timeline is output to a file, either stderr or the
  29.  * value of the environment variable NS_TIMELINE_LOG_FILE.  On the
  30.  * Mac, the timeline is output to the file named "timeline.txt".  The
  31.  * reason it's different on the Mac is that the Mac environment
  32.  * initialization code happens after timeline initialization code.
  33.  * 
  34.  * If NS_TIMELINE_INIT_TIME is set in the environment, that will be
  35.  * used as the time of startup; otherwise the current time when mark()
  36.  * is first called will be used.
  37.  * 
  38.  * mark() is used to put marks on the timeline.
  39.  * 
  40.  * indent() and outdent() are used to format the timeline a bit to
  41.  * show nesting.  This doesn't produce perfect results in the face of
  42.  * asychrony and multiple threads.
  43.  * 
  44.  * enter() and leave() are convenience functions that add marks to the
  45.  * timeline and do indentation.
  46.  * 
  47.  * startTimer() and stopTimer() control named stop watches.  If
  48.  * startTimer() is called more than once, an equal number of
  49.  * stopTimer() calls are needed to actually stop the timer.  This
  50.  * makes these timers slightly useful in a threaded environment.
  51.  * 
  52.  * markTimer() puts a mark on the timeline containing the total for
  53.  * the named timer.
  54.  * 
  55.  * Don't use nsITimelineService in C++ code; use the NS_TIMELINE
  56.  * macros instead.  nsITimelineService exists so that JavaScript code
  57.  * can mark the timeline.
  58.  */
  59. class NS_NO_VTABLE nsITimelineService : public nsISupports {
  60.  public: 
  61.  
  62.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ITIMELINESERVICE_IID)
  63.  
  64.   /**
  65.      * mark()
  66.      * Print "<elapsed time>: <text>\n" in the timeline log file.
  67.      */
  68.   /* void mark (in string text); */
  69.   NS_IMETHOD Mark(const char *text) = 0;
  70.  
  71.   /**
  72.      * causes subsequent marks to be indented for a more readable
  73.      * report.
  74.      */
  75.   /* void indent (); */
  76.   NS_IMETHOD Indent(void) = 0;
  77.  
  78.   /**
  79.      * Causes subsequent marks to be outdented.
  80.      */
  81.   /* void outdent (); */
  82.   NS_IMETHOD Outdent(void) = 0;
  83.  
  84.   /**
  85.      * enter/leave bracket code with "<text>..." and "...<text>" as
  86.      * well as indentation.
  87.      */
  88.   /* void enter (in string text); */
  89.   NS_IMETHOD Enter(const char *text) = 0;
  90.  
  91.   /* void leave (in string text); */
  92.   NS_IMETHOD Leave(const char *text) = 0;
  93.  
  94.   /* void startTimer (in string timerName); */
  95.   NS_IMETHOD StartTimer(const char *timerName) = 0;
  96.  
  97.   /* void stopTimer (in string timerName); */
  98.   NS_IMETHOD StopTimer(const char *timerName) = 0;
  99.  
  100.   /* void markTimer (in string timerName); */
  101.   NS_IMETHOD MarkTimer(const char *timerName) = 0;
  102.  
  103.   /* void resetTimer (in string timerName); */
  104.   NS_IMETHOD ResetTimer(const char *timerName) = 0;
  105.  
  106.   /* void markTimerWithComment (in string timerName, in string comment); */
  107.   NS_IMETHOD MarkTimerWithComment(const char *timerName, const char *comment) = 0;
  108.  
  109. };
  110.  
  111. /* Use this macro when declaring classes that implement this interface. */
  112. #define NS_DECL_NSITIMELINESERVICE \
  113.   NS_IMETHOD Mark(const char *text); \
  114.   NS_IMETHOD Indent(void); \
  115.   NS_IMETHOD Outdent(void); \
  116.   NS_IMETHOD Enter(const char *text); \
  117.   NS_IMETHOD Leave(const char *text); \
  118.   NS_IMETHOD StartTimer(const char *timerName); \
  119.   NS_IMETHOD StopTimer(const char *timerName); \
  120.   NS_IMETHOD MarkTimer(const char *timerName); \
  121.   NS_IMETHOD ResetTimer(const char *timerName); \
  122.   NS_IMETHOD MarkTimerWithComment(const char *timerName, const char *comment); 
  123.  
  124. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  125. #define NS_FORWARD_NSITIMELINESERVICE(_to) \
  126.   NS_IMETHOD Mark(const char *text) { return _to Mark(text); } \
  127.   NS_IMETHOD Indent(void) { return _to Indent(); } \
  128.   NS_IMETHOD Outdent(void) { return _to Outdent(); } \
  129.   NS_IMETHOD Enter(const char *text) { return _to Enter(text); } \
  130.   NS_IMETHOD Leave(const char *text) { return _to Leave(text); } \
  131.   NS_IMETHOD StartTimer(const char *timerName) { return _to StartTimer(timerName); } \
  132.   NS_IMETHOD StopTimer(const char *timerName) { return _to StopTimer(timerName); } \
  133.   NS_IMETHOD MarkTimer(const char *timerName) { return _to MarkTimer(timerName); } \
  134.   NS_IMETHOD ResetTimer(const char *timerName) { return _to ResetTimer(timerName); } \
  135.   NS_IMETHOD MarkTimerWithComment(const char *timerName, const char *comment) { return _to MarkTimerWithComment(timerName, comment); } 
  136.  
  137. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  138. #define NS_FORWARD_SAFE_NSITIMELINESERVICE(_to) \
  139.   NS_IMETHOD Mark(const char *text) { return !_to ? NS_ERROR_NULL_POINTER : _to->Mark(text); } \
  140.   NS_IMETHOD Indent(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Indent(); } \
  141.   NS_IMETHOD Outdent(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Outdent(); } \
  142.   NS_IMETHOD Enter(const char *text) { return !_to ? NS_ERROR_NULL_POINTER : _to->Enter(text); } \
  143.   NS_IMETHOD Leave(const char *text) { return !_to ? NS_ERROR_NULL_POINTER : _to->Leave(text); } \
  144.   NS_IMETHOD StartTimer(const char *timerName) { return !_to ? NS_ERROR_NULL_POINTER : _to->StartTimer(timerName); } \
  145.   NS_IMETHOD StopTimer(const char *timerName) { return !_to ? NS_ERROR_NULL_POINTER : _to->StopTimer(timerName); } \
  146.   NS_IMETHOD MarkTimer(const char *timerName) { return !_to ? NS_ERROR_NULL_POINTER : _to->MarkTimer(timerName); } \
  147.   NS_IMETHOD ResetTimer(const char *timerName) { return !_to ? NS_ERROR_NULL_POINTER : _to->ResetTimer(timerName); } \
  148.   NS_IMETHOD MarkTimerWithComment(const char *timerName, const char *comment) { return !_to ? NS_ERROR_NULL_POINTER : _to->MarkTimerWithComment(timerName, comment); } 
  149.  
  150. #if 0
  151. /* Use the code below as a template for the implementation class for this interface. */
  152.  
  153. /* Header file */
  154. class nsTimelineService : public nsITimelineService
  155. {
  156. public:
  157.   NS_DECL_ISUPPORTS
  158.   NS_DECL_NSITIMELINESERVICE
  159.  
  160.   nsTimelineService();
  161.  
  162. private:
  163.   ~nsTimelineService();
  164.  
  165. protected:
  166.   /* additional members */
  167. };
  168.  
  169. /* Implementation file */
  170. NS_IMPL_ISUPPORTS1(nsTimelineService, nsITimelineService)
  171.  
  172. nsTimelineService::nsTimelineService()
  173. {
  174.   /* member initializers and constructor code */
  175. }
  176.  
  177. nsTimelineService::~nsTimelineService()
  178. {
  179.   /* destructor code */
  180. }
  181.  
  182. /* void mark (in string text); */
  183. NS_IMETHODIMP nsTimelineService::Mark(const char *text)
  184. {
  185.     return NS_ERROR_NOT_IMPLEMENTED;
  186. }
  187.  
  188. /* void indent (); */
  189. NS_IMETHODIMP nsTimelineService::Indent()
  190. {
  191.     return NS_ERROR_NOT_IMPLEMENTED;
  192. }
  193.  
  194. /* void outdent (); */
  195. NS_IMETHODIMP nsTimelineService::Outdent()
  196. {
  197.     return NS_ERROR_NOT_IMPLEMENTED;
  198. }
  199.  
  200. /* void enter (in string text); */
  201. NS_IMETHODIMP nsTimelineService::Enter(const char *text)
  202. {
  203.     return NS_ERROR_NOT_IMPLEMENTED;
  204. }
  205.  
  206. /* void leave (in string text); */
  207. NS_IMETHODIMP nsTimelineService::Leave(const char *text)
  208. {
  209.     return NS_ERROR_NOT_IMPLEMENTED;
  210. }
  211.  
  212. /* void startTimer (in string timerName); */
  213. NS_IMETHODIMP nsTimelineService::StartTimer(const char *timerName)
  214. {
  215.     return NS_ERROR_NOT_IMPLEMENTED;
  216. }
  217.  
  218. /* void stopTimer (in string timerName); */
  219. NS_IMETHODIMP nsTimelineService::StopTimer(const char *timerName)
  220. {
  221.     return NS_ERROR_NOT_IMPLEMENTED;
  222. }
  223.  
  224. /* void markTimer (in string timerName); */
  225. NS_IMETHODIMP nsTimelineService::MarkTimer(const char *timerName)
  226. {
  227.     return NS_ERROR_NOT_IMPLEMENTED;
  228. }
  229.  
  230. /* void resetTimer (in string timerName); */
  231. NS_IMETHODIMP nsTimelineService::ResetTimer(const char *timerName)
  232. {
  233.     return NS_ERROR_NOT_IMPLEMENTED;
  234. }
  235.  
  236. /* void markTimerWithComment (in string timerName, in string comment); */
  237. NS_IMETHODIMP nsTimelineService::MarkTimerWithComment(const char *timerName, const char *comment)
  238. {
  239.     return NS_ERROR_NOT_IMPLEMENTED;
  240. }
  241.  
  242. /* End of implementation class template. */
  243. #endif
  244.  
  245. #endif /* MOZ_TIMELINE */
  246. #ifdef MOZ_TIMELINE
  247. /*
  248.  * These are equivalent to the corresponding nsITimelineService
  249.  * methods, and can be called before XPCOM is initialized.
  250.  */
  251. extern "C" NS_COM nsresult NS_TimelineMark(const char *text, ...);
  252. extern "C" NS_COM nsresult NS_TimelineForceMark(const char *text, ...);
  253. extern "C" NS_COM nsresult NS_TimelineStartTimer(const char *timerName);
  254. extern "C" NS_COM nsresult NS_TimelineStopTimer(const char *timerName);
  255. extern "C" NS_COM nsresult NS_TimelineResetTimer(const char *timerName);
  256. extern "C" NS_COM nsresult NS_TimelineMarkTimer(const char *timerName, const char *str=nsnull);
  257. extern "C" NS_COM nsresult NS_TimelineIndent();
  258. extern "C" NS_COM nsresult NS_TimelineOutdent();
  259. extern "C" NS_COM nsresult NS_TimelineEnter(const char *text);
  260. extern "C" NS_COM nsresult NS_TimelineLeave(const char *text);
  261. /*
  262.  * Use these macros for the above calls so we can easily compile them
  263.  * out.
  264.  */
  265. #define NS_TIMELINE_MARK(text) NS_TimelineMark(text)
  266. #define NS_TIMELINE_MARKV(args) NS_TimelineMark args
  267. #define NS_TIMELINE_INDENT() NS_TimelineIndent()
  268. #define NS_TIMELINE_OUTDENT() NS_TimelineOutdent()
  269. #define NS_TIMELINE_ENTER(text) NS_TimelineEnter(text)
  270. #define NS_TIMELINE_LEAVE(text) NS_TimelineLeave(text)
  271. #define NS_TIMELINE_START_TIMER(timerName) NS_TimelineStartTimer(timerName)
  272. #define NS_TIMELINE_STOP_TIMER(timerName) NS_TimelineStopTimer(timerName)
  273. #define NS_TIMELINE_MARK_TIMER(timerName) NS_TimelineMarkTimer(timerName)
  274. #define NS_TIMELINE_RESET_TIMER(timerName) NS_TimelineResetTimer(timerName)
  275. #define NS_TIMELINE_MARK_TIMER1(timerName, str) NS_TimelineMarkTimer(timerName, str)
  276. /*
  277.  * Helper class to time functions. Use only static strings.
  278.  */
  279. class nsFunctionTimer {
  280. public:
  281.     const char *mTimer;
  282.     PRBool mMark;
  283.     const char *mMarkStr;
  284.     nsFunctionTimer(const char *timer, PRBool mark = PR_TRUE, const char *markStr = nsnull)
  285.         : mTimer(timer), mMark(mark), mMarkStr(markStr)
  286.     {
  287.         NS_TIMELINE_START_TIMER(mTimer);
  288.     }
  289.     ~nsFunctionTimer()
  290.     {
  291.         NS_TIMELINE_STOP_TIMER(mTimer);
  292.         if (mMark)
  293.             if (mMarkStr)
  294.                 NS_TIMELINE_MARK_TIMER1(mTimer, mMarkStr);
  295.             else
  296.                 NS_TIMELINE_MARK_TIMER(mTimer);
  297.     }
  298. };
  299. /*
  300.  * NS_TIMELINE_MARK_ macros for various data types.  Each of these
  301.  * macros replaces "%s" in its "text" argument with a string
  302.  * representation of its last argument.
  303.  * 
  304.  * Please feel free to add more NS_TIMELINE_MARK_ macros for
  305.  * various data types so that code using NS_TIMELINE is uncluttered.
  306.  * Don't forget the empty versions in the #else section below for
  307.  * non-timeline builds.
  308.  */
  309. #define NS_TIMELINE_MARK_URI(text, uri) \
  310.     { \
  311.         nsCAutoString spec; \
  312.         if (uri) { \
  313.             uri->GetSpec(spec); \
  314.         } \
  315.         if (!spec.IsEmpty()) { \
  316.             NS_TimelineMark(text, spec.get()); \
  317.         } else { \
  318.             NS_TimelineMark(text, "??"); \
  319.         } \
  320.     }
  321. #define NS_TIMELINE_MARK_CHANNEL(text, channel) \
  322.     { \
  323.         nsCOMPtr<nsIURI> uri; \
  324.         if (channel) { \
  325.             channel->GetURI(getter_AddRefs(uri)); \
  326.         } \
  327.         NS_TIMELINE_MARK_URI(text, uri); \
  328.     }
  329. #define NS_TIMELINE_MARK_LOADER(text, loader) \
  330.     { \
  331.         nsCOMPtr<nsIRequest> request; \
  332.         loader->GetRequest(getter_AddRefs(request)); \
  333.         nsCOMPtr<nsIChannel> channel(do_QueryInterface(request)); \
  334.         NS_TIMELINE_MARK_CHANNEL(text, channel); \
  335.     }
  336. #define NS_TIMELINE_MARK_FUNCTION(timer) nsFunctionTimer functionTimer(timer)
  337. #define NS_TIMELINE_MARK_FUNCTION1(timer, str) nsFunctionTimer functionTimer(timer, PR_TRUE, str)
  338. #define NS_TIMELINE_TIME_FUNCTION(timer) nsFunctionTimer functionTimer(timer, PR_FALSE) /* no mark, only time */
  339. #else /* !defined(MOZ_TIMELINE) */
  340. #define NS_TIMELINE_MARK(text)
  341. #define NS_TIMELINE_MARKV(args)
  342. #define NS_TIMELINE_INDENT()
  343. #define NS_TIMELINE_OUTDENT()
  344. #define NS_TIMELINE_START_TIMER(timerName)
  345. #define NS_TIMELINE_STOP_TIMER(timerName)
  346. #define NS_TIMELINE_MARK_TIMER(timerName)
  347. #define NS_TIMELINE_RESET_TIMER(timerName)
  348. #define NS_TIMELINE_MARK_TIMER1(timerName, str)
  349. #define NS_TIMELINE_ENTER(text)
  350. #define NS_TIMELINE_LEAVE(text)
  351. #define NS_TIMELINE_MARK_URI(text, uri)
  352. #define NS_TIMELINE_MARK_FUNCTION(timer)
  353. #define NS_TIMELINE_TIME_FUNCTION(timer)
  354. #define NS_TIMELINE_MARK_CHANNEL(text, channel)
  355. #define NS_TIMELINE_MARK_LOADER(text, loader);
  356. #endif /* defined(MOZ_TIMELINE) */ 
  357.  
  358. #endif /* __gen_nsITimelineService_h__ */
  359.